home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 7978 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.1 KB

  1. Path: news.ov.com!news
  2. From: glenn@ov.com (Fletcher.Glenn@ov.com)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: need for function prototypes
  5. Date: 29 Feb 1996 23:20:17 GMT
  6. Organization: OpenVision
  7. Message-ID: <4h5cbh$2pi@spanky.pls.ov.com>
  8. References: <4gutho$o1a@mn5.swip.net>
  9. Reply-To: glenn@ov.com
  10. NNTP-Posting-Host: foghorn.pls.ov.com
  11.  
  12. In article o1a@mn5.swip.net, chris.rossall@mailbox.swipnet.se (Chris Rossall) writes:
  13. >Hello I am having trouble understanding why I should use function
  14. >prototypes. I mean,if the function is defined before it is used,the
  15. >compiler should have enough information about the parameters to
  16. >produce correct code anyway.
  17. >
  18. >-Chris 
  19. >
  20.  
  21.  
  22. Yes, but what about the following cases:
  23.  
  24. 1.  The function is defined in another code module.  Without prototypes, how
  25.     would the compiler know how to link with the function?  This is also
  26.     true of library calls (usually prototyped in a header file).
  27.  
  28. 2.  The function is defined later in the program source.  A function prototype
  29.     allows you to put higher level (and therefore more understandable) stuff
  30.     at the beginning of your source file.
  31.  
  32.             Fletcher.Glenn@ov.com
  33.  
  34.